using System;
using System.Collections.Generic;
using System.Text;

namespace IGGCore
{
    /// <summary>
    /// The core game properties
    /// </summary>
    public class Game : IComparable<Game>
    {
        private string m_id;
        private int m_ratio;
        private Team m_awayTeam;
        private Team m_homeTeam;
        private string m_ampm;
        private Stadium m_stadium;
        private string m_pk;
        private string m_startTime;
        private string m_timeZone;
        private string m_type;
        private string m_resumeDate;
        private string m_day;
        private string m_gamedaySW;
        private string m_league;

        private GameStatus m_status;
        private Linescore m_linescore;
        private Boxscore m_boxscore;
        private Probable m_awayProbable;
        private Probable m_homeProbable;

        public Probable AwayProbable
        {
            get { return m_awayProbable; }
            set { m_awayProbable = value; }
        }
        

        public Probable HomeProbable
        {
            get { return m_homeProbable; }
            set { m_homeProbable = value; }
        }

        public Boxscore Boxscore
        {
            get { return m_boxscore; }
            set { m_boxscore = value; }
        }

        public string Day
        {
            get { return m_day; }
            set { m_day = value; }
        }

        public string Type
        {
            get { return m_type; }
            set { m_type = value; }
        }

        public string StartTime
        {
            get { return m_startTime; }
            set { m_startTime = value; }
        }

        public string TimeZone
        {
            get { return m_timeZone; }
            set { m_timeZone = value; }
        }
        
        public int AwayScore
        {
            get 
            {
                if (m_linescore != null)
                {
                    return m_linescore.GetAwayLineScore().Runs;
                }
                else
                {
                    return 0;
                }
            }
        }
        
        public int HomeScore
        {
            get
            {
                if (m_linescore != null)
                {
                    return m_linescore.GetHomeLineScore().Runs;
                }
                else
                {
                    return 0;
                }
            }
        }

        public string Id
        {
            get { return m_id; }
            set { m_id = value; }
        }

        public int Ratio
        {
            get { return m_ratio; }
            set { m_ratio = value; }
        }

        public Team AwayTeam
        {
            get { return m_awayTeam; }
            set { m_awayTeam = value; }
        }

        public Team HomeTeam
        {
            get { return m_homeTeam; }
            set { m_homeTeam = value; }
        }

        public string AmPm
        {
            get { return m_ampm; }
            set { m_ampm = value; }
        }

        public Stadium Stadium
        {
            get { return m_stadium; }
            set { m_stadium = value; }
        }

        public string PK
        {
            get { return m_pk; }
            set { m_pk = value; }
        }

        public string ResumeDate
        {
            get { return m_resumeDate; }
            set { m_resumeDate = value; }
        }

        public string GamedaySW
        {
            get { return m_gamedaySW; }
            set { m_gamedaySW = value; }
        }

        public string League
        {
            get { return m_league; }
            set { m_league = value; }
        }

        public GameStatus Status
        {
            get { return m_status; }
            set { m_status = value; }
        }

        public Linescore Linescore
        {
            get { return m_linescore; }
            set { m_linescore = value; }
        }

        int IComparable<Game>.CompareTo(Game other)
        {
            return other.Ratio.CompareTo(this.Ratio);
        }
    }
}
